// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
import App from './App.vue';
import ElementUI from 'element-ui';


import home from 'components/home/home.vue';
import about from 'components/about/about.vue';
import product from 'components/product/product.vue';
import cases from 'components/cases/cases.vue';
import contact from 'components/contact/contact.vue';
import mien from 'components/mien/mien.vue';
import foo from 'components/foo/foo.vue';
import bar from 'components/bar/bar.vue';
import cee from 'components/cee/cee.vue';
import product1 from 'components/product1/product1.vue';
import product2 from 'components/product2/product2.vue';
import product3 from 'components/product3/product3.vue';
import product4 from 'components/product4/product4.vue';
import cases1 from 'components/cases1/cases1.vue';
import cases2 from 'components/cases2/cases2.vue';
import cases3 from 'components/cases3/cases3.vue';

// import 'bootstrap/bootstrap.min.css';
// import 'bootstrap/bootstrap.min.js';

Vue.use(VueRouter);
Vue.use(VueResource);
Vue.use(ElementUI);
// Vue.use($);
// 0. 如果使用模块化机制编程，導入Vue和VueRouter，要调用 Vue.use(VueRouter)

// 1. 定义（路由）组件。 可以从其他文件 import 进来


// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是通过 Vue.extend() 创建的组件构造器，或者，只是一个组件配置对象。
// 我们晚点再讨论嵌套路由。
const routes = [
  {path: '/', redirect: '/home'},
  {path: '/home', component: home},
  {path: '/about', component: about},
  {path: '/cases', component: cases},
  {path: '/product', component: product},
  {path: '/mien', component: mien},
  {path: '/contact', component: contact},
  {path: '/foo', component: foo},
  {path: '/bar', component: bar},
  {path: '/cee', component: cee},
  {path: '/product1', component: product1},
  {path: '/product2', component: product2},
  {path: '/product3', component: product3},
  {path: '/product4', component: product4},
  {path: '/cases1', component: cases1},
  {path: '/cases2', component: cases2},
  {path: '/cases3', component: cases3}
];


// 3. 创建 router 实例，然后传 `routes` 配置 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
  linkActiveClass: 'active',
  routes // （缩写）相当于 routes: routes
});

// 4. 创建和挂载根实例。记得要通过 router 配置参数注入路由，从而让整个应用都有路由功能

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
});

